<template>
  <el-dialog :model-value="prop.isShow" title="备注订单" width="450px" @close="cancel">
    <span style="line-height: 45px;">操作备注：</span>
    <el-input type="textarea" v-model.trim="ipt" :rows="5"
    style="width:250px;margin-left: 20px;vertical-align: top;"/>
      <template #footer>
      <span class="dialog-footer">
        <el-button @click="cancel">Cancel</el-button>
        <el-button type="primary" @click="confirm">
          Confirm
        </el-button>
      </span>
    </template>
  </el-dialog>
</template>
<script setup lang="ts">
import { Order } from '@/request/api';
import { ElMessage } from 'element-plus';
import { ref } from 'vue';
let prop = defineProps<{
  isShow:boolean,
  id:number | string | string[],
  status: any
}>()
let emit = defineEmits<{(e:"update:isShow",param:boolean)}>()
let ipt = ref("")
const cancel = function(){
  emit("update:isShow",false)
  ipt.value = ""
}
const confirm = async function(){
  if(ipt){
    let id = Number(prop.id)
    let status = prop.status
    let result = await Order.OrderUpdateNoteAPI({id,status,note:ipt.value})
    if(result===1){
      ElMessage.success("备注成功")
      cancel()
    }
  }
}
</script>